CSE 16: Applied Discrete Mathematics
Instructor: Owen Arden
Winter 2023
Sets, Venn diagrams, union, intersection… isn’t this like elementary school stuff?
Here we are going to formalize the treatment of sets
Sets play a foundational role in math (and memes):
Georg
Cantor (before 19th century mental health care)
Georg Cantor (after 19th century mental health
care)
The “naive” treatment of sets is easy to understand, but leads to some paradoxes. It is enough to prove the theorems we care about here, though.
Objects in a set are called elements or members of the set, and we say that a set contains its elements.
In general, sets are often written using uppercase letters and their elements using lowercase letters.
Set builder notation specifies the properties all members of the set must satisfy
\(S = \{ x : x \text{ is a positive integer less than } 100 \}\)
\(O = \{ x : x \text{ is an odd positive integer less than } 10 \}\)
\[\mathbb{Q}^{+} = \{ x \in \mathbb{R} : x = \frac{p}{q} \text{ for some positive integers } p,q \text{ where } q \neq 0 \}\]
\([a,b] = \{x | a \leq x \leq b \}\)
\([a,b) = \{x | a \leq x \lt b \}\)
\((a,b] = \{x | a \lt x \leq b \}\)
\((a,b) = \{x | a \lt x \lt b \}\)
Are these sets equal?
\(\{a, b, c, d\}\) and \(\{a, b, c, b, c, d\}\)
\(\{a, b, c, d\}\) and \(\{a, b, \{c, d\}\}\)
\(\{a, b, c, d\}\) and \(\{c, d, a, b\}\)
Two sets are equal if (and only if) they have the same elements.
If \(A\) and \(B\) are sets, then \(A\) and \(B\) are equal if and only if \[\forall x. (x \in A \leftrightarrow x \in B)\] or equivalently \[\forall x. (x \in A \to x \in B) \wedge (x \in B \to x \in A)\]
Let \(A = \{1, 5, 5, 5, 3, 3, 1\}\) and \(B = \{1, 3, 5\}\). Prove that \(A=B\).
We want to show that \[\forall x. (x \in A \to x \in B) \wedge (x \in B \to x \in A)\]
How many cases are there?
To prove \(A\) is a not subset of \(B\), we want to find an element \(x \in A\) where \(x \not\in B\).
\(\neg \forall x. (x \in A \to x \in B)\)
\(\exists x. \neg(x \in A \to x \in B)\)
\(\exists x. \neg(\neg(x \in A) \vee (x \in B))\)
\(\exists x. (x \in A \wedge x \not \in B)\)
\[\forall x. (x \in A \to x \in B)\]
\(\{1, 5, 5, 5, 3, 3, 1\} \subseteq \{1, 3, 5\}\)
\(S \subseteq S\) for every set \(S\)?
\(\emptyset \subseteq S\) for every set \(S\)?
Yes, every element of \(\emptyset\) is in \(S\), there just aren’t any members.
\(\forall x. x \in \emptyset \to x \in S\) is vacuously true: \(x \in \emptyset\) is always false.
Let S be the set of integers with squares less than 100.
Proof:
\(\square\)
\[ \forall x. (x \in A \leftrightarrow x \in B)\]
\[ \forall x. (x \in A \to x \in B) \wedge (x \in B \to x \in A)\]
\[ A \subseteq B \wedge B \subseteq A \]
\(\mathbb{B} \subset \mathbb{R}\)
\(\mathbb{Z} \subseteq \mathbb{N}\)
\(-3 \subseteq \mathbb{R}\)
\(\{1,2\} \not\in \mathbb{Z}^{+}\)
\(\emptyset \subseteq \emptyset\)
\(\emptyset \subset \emptyset\)
\(\{x\} \subseteq \{x\}\)
\(\{x\} \in \{x, \{x\} \}\)
\(\{x\} \subseteq \{x, \{x\} \}\)
\(\{x\} \in \{x\}\)
\(\{\{x\}\} \subset \{x, \{x\} \}\)
Example: If \(A = \{a, b\}\), then \[ \mathcal{P}(A) = \{ \emptyset, \{a\}, \{b\}, \{a, b\}\} \]
What is the cardinality of \(\mathcal{P}(A)\)?
If a set has \(n\) elements, then the cardinality of its power set is \(2^{n}\).
What is \(\mathbb{R}^{2}\)?
What about \(\mathbb{R}^{3}\)?
Two n-tuples are equal iff their corresponding elements are equal.
2-tuples are called ordered pairs or sometimes just pairs.
pair:
3-tuple: \((1, 3, 5)\)
5-tuple: \((1, 5, 5, 3)\)
Order and repetition matter with n-tuples
\((1, 5, 5, 3) \neq (1, 3, 5)\)
\[A \times B \triangleq \{ (a, b) ~|~ a \in A \wedge b \in B \}\]
Example: Let \(A = \{a, b\}\) and \(B = \{1, 2, 3\}\). \[A \times B = \{(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)\}\]
\[A_1 \times A_2 \times ... \times A_n \triangleq \{ (a_1, a_2, ..., a_n) ~|~ a_i \in A_i \text{ for } i \in [1, n] \}\]
Example: Let \(A = \{0, 1\}\), \(B = \{1, 2\}\), and \(C=\{0,1,2\}\). \[\begin{align} A \times B \times C = \{ &(0,1,0), (0,1,1), (0,1,2), \\ &(0,2,0), (0,2,1), (0,2,2), \\ &(1,1,0), (1,1,1), (1,1,2), \\ &(1,2,0), (1,2,1), (1,2,2)\} \end{align}\]
\(\mathbb{R}^2 = \mathbb{R} \times \mathbb{R}\)
\(\mathbb{R}^3 = \mathbb{R} \times \mathbb{R} \times \mathbb{R}\)
Example:
Dads \(\cup\) Jokes
Example:
Dads \(\cap\) Jokes
\[\begin{align} \bigcup_{i=1}^{n} A_i &= A_1 \cup A_2 \cup ... \cup A_n \\ \bigcap_{i=1}^{n} A_i &= A_1 \cap A_2 \cap ... \cap A_n \\ \end{align}\]
There are well defined since union and intersection are associative.
\[ \bigcup_{i=1}^{n} A_i = \{i,i+1,i+2,...\} = ???\]
\[\{1,2,3,...\}\]
\[ \bigcap_{i=1}^{n} A_i = A_1 \cap A_2 \cap ... \cap A_n\]
\[\{n,n+1,n+2,...\} = A_n\]
Example:
\(\overline{\text{Jokes}}\)
Example:
Dads \(-\) Jokes
Example:
\(U = \{0,1,2,3,4,5,6,7,8,9,10\}\) \(A = \{1,2,3,4,5\}\) \(B = \{4,5,6,7,8\}\)
Dads \(\oplus\) Jokes
\(U = \{0,1,2,3,4,5,6,7,8,9,10\}\)
\(A = \{1,2,3,4,5\}\) \(B = \{4,5,6,7,8\}\)
\[|A \cup B| = |A| + |B| - |A \cap B|\]
Name | Notation | Definition |
---|---|---|
Intersection | \(A \cap B\) | \(\{x: x \in A \wedge x \in B\}\) |
Union | \(A \cup B\) | \(\{x: x \in A \vee x \in B\}\) |
Difference | \(A - B\) | \(\{x: x \in A \wedge x \not\in B\}\) |
Symmetric difference | \(A \oplus B\) | \(\{x: x \in (A-B) \wedge x \in (B-A)\}\) |
Complement | \(\overline{A}\) | \(\{x : x \not\in A\}\) |
Set theory and propositional calculus are both instances of an algebraic system called a Boolean algebra (after George Boole).
Set theory operators have analogous operators in propositional calculus: \[\begin{align} A \cap B \qquad &\sim \qquad A \wedge B \\ A \cup B \qquad &\sim \qquad A \vee B \\ \overline{A} \qquad &\sim \qquad \neg A \end{align}\]
All sets are assumed to be subsets of the universal set \(U\).
Remember these?
Idempotence | \(p \vee p \equiv p\) | \(p \wedge p \equiv p\) |
Associativity | \((p \vee q) \vee r \equiv p \vee (q \vee r)\) | \((p \wedge q) \wedge r \equiv p \wedge (q \wedge r)\) |
Commutativity | \(p \vee q \equiv q \vee p\) | \(p \wedge q \equiv q \wedge p\) |
Distributivity | \(p \vee (q \wedge r) \equiv (p \vee q) \wedge (p \vee r)\) | \(p \wedge (q \vee r) \equiv (p \wedge q) \vee (p \wedge r)\) |
Identity | \(p \vee \textsf{F} \equiv p\) | \(p \wedge \textsf{T} \equiv \textsf{T}\) |
Domination | \(p \wedge \textsf{F} \equiv \textsf{F}\) | \(p \vee \textsf{T} \equiv \textsf{T}\) |
Double Complement | \(\neg \neg p \equiv p\) | |
Complement | \(p \wedge \neg p \equiv
\textsf{F}\) \(~~~~~~\neg \textsf{T} \equiv \textsf{F}\) |
\(p \vee \neg p \equiv \textsf{T}\)
\(\neg \textsf{F} \equiv \textsf{T}\) |
De Morgans | \(\neg (p \vee q) \equiv \neg p \wedge \neg q\) | \(\neg (p \wedge q) \equiv \neg p \vee \neg q\) |
Absorption | \(p \vee (p \wedge q) \equiv p\) | \(p \wedge (p \vee q) \equiv p\) |
They work for sets too!
Idempotence | \(p \cup p \equiv p\) | \(p \cap p \equiv p\) |
Associativity | \((p \cup q) \cup r \equiv p \cup (q \cup r)\) | \((p \cap q) \cap r \equiv p \cap (q \cap r)\) |
Commutativity | \(p \cup q \equiv q \cup p\) | \(p \cap q \equiv q \cap p\) |
Distributivity | \(p \cup (q \cap r) \equiv (p \cup q) \cap (p \cup r)\) | \(p \cap (q \cup r) \equiv (p \cap q) \cup (p \cap r)\) |
Identity | \(p \cup \emptyset \equiv p\) | \(p \cap \textsf{U} \equiv \textsf{U}\) |
Domination | \(p \cap \emptyset \equiv \emptyset\) | \(p \cup \textsf{U} \equiv \textsf{U}\) |
Double Complement | \(\overline{\overline{p}} \equiv p\) | |
Complement | \(p \cap \overline{p} \equiv
\emptyset\) \(~~~~~~\overline{\textsf{U}} \equiv \emptyset\) |
\(p \cup \overline{p} \equiv
\textsf{U}\) \(\overline{\emptyset} \equiv \textsf{U}\) |
De Morgans | \(\overline{(p \cup q)} \equiv \overline{p} \cap \overline{q}\) | \(\overline{(p \cap q)} \equiv \overline{p} \cup \overline{q}\) |
Absorption | \(p \cup (p \cap q) \equiv p\) | \(p \cap (p \cup q) \equiv p\) |
Theorem: \(\overline{(p \cap q)} \equiv \overline{p} \cup \overline{q}\)
Proof. We prove this in two steps:
Step 1. \(\overline{(p \cap q)} \subseteq \overline{p} \cup \overline{q}\)
Step 2. \(\overline{p} \cup \overline{q} \subseteq \overline{(p \cap q)}\)
Step 1. \(\overline{(p \cap q)} \subseteq \overline{p} \cup \overline{q}\)
\[\begin{align} x \in \overline{(p \cap q)} & \qquad \text{by assumption} \\ x \not\in (p \cap q) & \qquad \text{defn. of complement} \\ \neg ((x \in p) \wedge (x \in q)) & \qquad \text{defn. of intersection} \\ \neg (x \in p) \vee \neg (x \in q) & \qquad \text{De Morgan's (prop. logic)} \\ (x \not\in p) \vee (x \not\in q) & \qquad \text{defn. of negation} \\ (x \in \overline{p}) \vee (x \in \overline{q}) & \qquad \text{defn. of complement} \\ (x \in \overline{p}) \cup (x \in \overline{q}) & \qquad \text{defn. of union} \end{align}\]
Step 2. \(\overline{p} \cup \overline{q} \subseteq \overline{(p \cap q)}\)
\[\begin{align} x \in \overline{p} \cup \overline{q} & \qquad \text{by assumption} \\ (x \in \overline{A}) \vee (x \in \overline{B}) & \qquad \text{defn. of union} \\ (x \not\in A) \vee (x \not\in B) & \qquad \text{defn. of complement} \\ \neg(x \in A) \vee \neg(x \in B) & \qquad \text{defn. of negation} \\ \neg((x \in A) \wedge (x \in B)) & \qquad \text{De Morgan's (prop. logic)} \\ \neg((x \in (A \cap B)) & \qquad \text{defn. of intersection} \\ x \in \overline{A \cap B} & \qquad \text{defn. of complement} \\ \end{align}\]
\[\begin{align} A &= \{1,2,3,4,5,6,7,8,9\} \\ A_1 &= \{2,4,6\} \\ A_2 &= \{1,3,5\} \\ A_3 &= \{7,8,9\} \end{align}\]
Naive set theory leads to paradoxes